import { _decorator, animation, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

enum animationKey {
    idle = 'isIdle',
    isRun = 'isRun',
}

@ccclass('TestMarionette')
export class TestMarionette extends Component {

    @property(animation.AnimationController)
    animationController: animation.AnimationController = null

    @property(Node)
    touchNodeRun: Node = null

    start() {

        this.touchNodeRun.on(Node.EventType.TOUCH_START, () => {
            this.animationController.setValue(animationKey.isRun, true)
        })
        this.touchNodeRun.on(Node.EventType.TOUCH_END, () => {
            this.animationController.setValue(animationKey.isRun, false)
        })
        this.touchNodeRun.on(Node.EventType.TOUCH_CANCEL, () => {
            this.animationController.setValue(animationKey.isRun, false)
        })
    }

    update(deltaTime: number) {
        
    }

   
}


